import { createRouter, createWebHistory } from "vue-router"
const Home = () => import("../views/Home/index.vue")
const Login = () => import("../views/Login/index.vue")
const Music = () => import("../views/Home/components/Music/index.vue")
const News = () => import("../views/Home/components/News/index.vue")
const MusicItem = () => import("../views/Home/components/Music/MusicItem.vue")
const NewsItem = () => import("../views/Home/components/News/NewsItem.vue")

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: "/home",
            component: Home,
            name: "home",
            children: [
                {
                    path: "music",
                    component: Music,
                    name: "music",
                    children: [
                        {
                            path: "musicItem/:name/:order?",//加:代表params参数
                            component: MusicItem,
                            name: "musicItem",
                        },

                    ]
                },
                {
                    path: "news",
                    component: News,
                    name: "news",
                    children: [
                        {
                            path: "newsItem",
                            component: NewsItem,
                            name: "newsItem",
                        },

                    ]
                }
            ]
        },
        {
            path: "/login",
            component: Login,
            name: "login"
        }
    ]
});

export default router